package com.blog.Bard.base.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping
public class BardErrorController implements ErrorController {

	protected final Logger logger = LoggerFactory.getLogger(this.getClass());
	
	/**
	 * 	错误页面
	 * @param model
	 * @return
	 */
	@Override
	public String getErrorPath() {
		logger.info("execute the ErrorController 's error method...");
		return "/error";
	}
	
	@RequestMapping("/404")
	public String error404(Model model) {
		logger.info("execute the BardErrorController 's error404 method...");
		return "error/404";
	}
	
	@RequestMapping("/400")
	public String error400(Model model) {
		logger.info("execute the BardErrorController 's error400 method...");
		return "error/400";
	}
	
	@RequestMapping("/500")
	public String error500(Model model) {
		logger.info("execute the BardErrorController 's error500 method...");
		return "error/500";
	}
	
}
